home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.c
- Subject: Re: void test(...)
- Date: Mon, 18 Mar 1996 19:17:04 GMT
- Organization: Netcom
- Message-ID: <314dae95.240874709@nntp.ix.netcom.com>
- References: <4if00v$hdk@news.NetVision.net.il>
- NNTP-Posting-Host: ix-dc12-16.ix.netcom.com
- X-NETCOM-Date: Mon Mar 18 11:16:40 AM PST 1996
- X-Newsreader: Forte Agent .99d/32.182
-
- nir@netvision.net.il (Nir Sofer) wrote:
-
- > I know that i can create in C a function with variable number of arguments.
- >
- > void test(...)
- > {
- >
- > }
- >
- > But i can i use these arguments ???
-
- What you know is incorrect. That is not legal in C. In C there must
- be at least one explicit argument, e.g.,
-
- #include <stdarg.h>
-
- void test(int n, ...)
- {
- /* ... */
- }
-
- In this case you can access the remaining arguments with the macros in
- <stdarg.h>
-
-
- Michael M Rubenstein
-